package com.example.myapplication.model

/**
 * 股票分析结果
 * 包含股票基本信息和买卖点预测
 */
data class StockAnalysis(
    val symbol: String,
    val name: String,
    val industry: String,
    val currentPrice: Double,
    val tradingSignal: TradingSignal?,
    val buyPoints: List<TradingPoint>,
    val sellPoints: List<TradingPoint>,
    val latestAction: String,  // 最新操作建议
    val actionTime: String?     // 建议操作时间
) {
    /**
     * 获取最强买入点
     */
    fun getStrongestBuyPoint(): TradingPoint? {
        return buyPoints.maxByOrNull { it.strength }
    }
    
    /**
     * 获取最强卖出点
     */
    fun getStrongestSellPoint(): TradingPoint? {
        return sellPoints.maxByOrNull { it.strength }
    }
    
    /**
     * 是否有买入机会
     */
    fun hasBuyOpportunity(): Boolean {
        return tradingSignal?.isBuySignal() == true && buyPoints.isNotEmpty()
    }
    
    /**
     * 是否有卖出信号
     */
    fun hasSellSignal(): Boolean {
        return tradingSignal?.isSellSignal() == true && sellPoints.isNotEmpty()
    }
}



